<?php
class Administrator_IndexController extends Nguyen_Controller_Action{
	public function init(){
		$this->loadTemplate('administrator');
	}
	public function indexAction(){ 
		print_r($this->_request->getParams());
		$auth = Zend_Auth::getInstance();
		echo '<pre>';
		$info = $auth->getIdentity();
		print_r($info);
		echo '</pre>';
	}	
	public function siteinfoAction(){ 
		$this->StaffOnly();
		$auth = Zend_Auth::getInstance();
		$infoUser = $auth->getIdentity();
		if($auth->hasIdentity()){
			$this->view->uinfo = $infoUser;
		}
		$model = new Administrator_Model_System();
		if ($this->_request->isPost()){	
			if($this->_request->getParam('btsave')){
				$sitename = $this->_request->getParam('sitename','');
				$meta = $this->_request->getParam('meta','');
				$description = $this->_request->getParam('description','');
				$email = $this->_request->getParam('email','');
				$website = $this->_request->getParam('website','');
				$fax = $this->_request->getParam('fax','');
				$phone = $this->_request->getParam('phone','');
				$mobile = $this->_request->getParam('mobile','');
				$address = $this->_request->getParam('address','');
				$status = $this->_request->getParam('multilang','');
				$siteoffline = $this->_request->getParam('closewebsite','');
				$offnotice = $this->_request->getParam('offnotice','');
				if($infoUser->type == 1)$model->UpdateSiteInfo($sitename, $meta, $description, $email, $website, $fax, $phone, $mobile, $address,$siteoffline,$offnotice, $status);
				else $model->UpdateSiteInfoNoAdmin($sitename, $meta, $description, $email, $website, $fax, $phone, $mobile, $address, $status);
				$this->_redirect('/administrator/index/siteinfo');
			}
			if($this->_request->getParam('btback')){
				$this->_redirect('/administrator');
			}
		}
		$this->view->headTitle('Control Panel | Thông tin website',true);
	}
	public function noaccessAction(){ 
        
	}
}